<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Session
 *
 * @author virtual
 */
Session::start();

class Session {
    public static function start() {
        session_start(); 
    }
    public static function clear() {
        
        unset($_SESSION["username"]);
        session_destroy();
    }
    
    public static function name() {
        return session_name();
    }
    
    public static function setParam($key, $value){
        if(isset($_SESSION))
            $_SESSION["param"][$key] = $value;
    }
    
    public static function getParam($key){
        if(isset($_SESSION))
            return $_SESSION["param"][$key];
        return "session not set";
    }
    
    public static function setUser($user) {
        $_SESSION["username"] = $user;
    }
    public static function setRole($role) {
        $_SESSION["userrole"] = $role;
    }
    
    public static function getUser() {
        if(isset($_SESSION["username"])){
            return $_SESSION["username"];
        }
        return null;
    }
    public static function getRole() {
        if(isset($_SESSION["userrole"])){
            return $_SESSION["userrole"];
        }
        return null;
    }    
}

?>
